package ag.core;

import java.io.IOException;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.util.Log;

public class AGSound {
	private AGEngine engine;
	private SoundPool soundPool;
	private MediaPlayer mediaPlayer;
	
	public AGSound(AGEngine engine){
		this.engine = engine;
		this.soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
		
	}
	
	public int loadSound(Context context, int id){
		return this.soundPool.load(context, id, 1);
//		try{
//			this.mediaPlayer = MediaPlayer.create(context, id);
//		}catch(Exception ex){
//			Log.d("sv2", "error");
//		}
//		return 0;
	}
	
	public void play(int id){
//		try {
//			this.mediaPlayer.prepare();
//		} catch (IllegalStateException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		this.mediaPlayer.start();
		this.soundPool.play(id, 1, 1, 0, 0, 2);
	}
}
